package com.exam.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 答题信息实体 2012-12-27
 * 
 * @author MuLing
 * 
 */
@Entity
@Table(name = "tb_answer_Info")
public class AnswerInfo implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	// 指定为主键
	@GeneratedValue(strategy = GenerationType.AUTO)
	// 主键类型为自增长
	private Integer id;// 主键id

	@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
	@JoinColumns(@JoinColumn(name = "oa_id", referencedColumnName = "id"))
	private ObjectiveAnswer objectiveAnswer;// 本次考试对应的试卷，来自试卷表

	@ManyToOne(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
	@JoinColumns(@JoinColumn(name = "u_id", referencedColumnName = "id"))
	private User user;// 本次考试对应的用户，来自用户表

	@Column(name = "u_answer", length = 30)
	private String answer;// 用户考试时长，分钟计时

	/**
	 * @param objectiveAnswer the objectiveAnswer to set
	 */
	public void setObjectiveAnswer(ObjectiveAnswer objectiveAnswer) {
		this.objectiveAnswer = objectiveAnswer;
	}

	/**
	 * @return the objectiveAnswer
	 */
	public ObjectiveAnswer getObjectiveAnswer() {
		return objectiveAnswer;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param answer the answer to set
	 */
	public void setAnswer(String answer) {
		this.answer = answer;
	}

	/**
	 * @return the answer
	 */
	public String getAnswer() {
		return answer;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}
}
